﻿//商品类别
window.operateEvents = {
    'click .cz': function (e, value, row, index) {
        var status = row.Status == "0" ? "1" : "0";


        MyDialog.confirm("你确定要进行此项操作？", function () {
            $.post("../SpeList/DLLAjaxHandler.ashx", { Action: "YH_STATUS", id: row.ID, status: status },
function (data) {
    if (data == "success") {
        $("#FTGrid").bootstrapTable('updateRow', {
            index: index,
            row: {
                Status: status
            }
        });
        toastr.success("操作成功");

    } else {
        toastr.error("操作失败");
    }
});
        }, function () {

        })

    },
    'click .viewxx': function (e, value, row, index) {
        MyDialog.viewform("SpeList/UserInfo.html?ID=" + row.ID, "查看详细内容");
    },
    'click .xgtjr': function (e, value, row, index) {
        MyDialog.viewform("SpeList/SelTJR.html?ID=" + row.ID, "查看详细内容");
    }
};
var option = {};
option.columns = [
             {
                 field: 'ID',
                 title: '序号'
             }, {
                 sortable: true,
                 field: 'UserName',
                 title: '用户名'
             }, {
                 field: 'Email',
                 title: '邮箱',
             }, {
                 field: 'Telephone',
                 title: '联系电话',
             }, {
                 field: 'TrueName',
                 title: '真实姓名'
             }, {
                 field: 'NickName',
                 title: '昵称'
             }, {
                 field: 'Sex',
                 title: '性别'
             }, {
                 field: 'RefUserName',
                 title: '推荐人'
             }, {
                 field: 'Province',
                 title: '地址',
                 formatter: function (value, row) {
                     return row.Province + row.City + row.County + row.Address;
                 }
             }, {
                 field: 'Status',
                 title: '状态',
                 formatter: function (value, row) {
                     if (value == "0") {
                         return "正常帐号";
                     } else {
                         return "<B style='color:red;' >已禁用</B>";

                     }
                 }
             }
             , {
                 field: 'CreateTime',
                 title: '操作', formatter: function (value, row) {
                     if (!ComFunJS.getQueryString("ListType")) {
                         if (row.Status == "0") {
                             return '<a href="#" style="margin-left:10px" class="cz" >禁用</a> <a href="#" style="margin-left:10px" class="viewxx" >查看详细信息</a><a href="#" style="margin-left:10px" class="xgtjr" >修改推荐人</a>';
                         } else {
                             return '<a href="#" style="margin-left:10px" class="cz" >启用</a> <a href="#" style="margin-left:10px" class="viewxx" >查看详细信息</a><a href="#" style="margin-left:10px" class="xgtjr" >修改推荐人</a>';

                         }
                     }
                 },
                 events: operateEvents
             }
];
$(document).ready(function () {
    $(".addForm,.EditForm,.DelForm").remove();
});

